﻿#include"errorCheck.h"
#include"glad/glad.h"
#include"GLFW/glfw3.h"
#include<iostream>
#include<assert.h>
using namespace std;
void errorCheck() {
	GLenum errorCode = glGetError();
	string errStr = "";
	if(errorCode!= GL_NO_ERROR){
		switch (errorCode) {
		case GL_INVALID_ENUM:errStr = "GL_INVALID_ENUM"; break;
		case GL_INVALID_VALUE:errStr = "GL_INVALID_VALUE"; break;
		case GL_INVALID_OPERATION:errStr = "GL_INVALID_OPERATION"; break;
		case GL_OUT_OF_MEMORY:errStr = "GL_OUT_OF_MEMORY"; break;
		default:
			errStr = "OTHER ERROR";
		}
		cout << errStr << endl;
		//assert是断言函数，传false表示在此处中断程序，传true表示程序正常继续执行
		assert(false);
	}

}